<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php');

/**
 * Participation filter form base class.
 *
 * @package    filters
 * @subpackage Participation *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseParticipationFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'recepient_id'      => new sfWidgetFormDoctrineChoice(array('model' => 'Recepient', 'add_empty' => true)),
      'batch_id'          => new sfWidgetFormDoctrineChoice(array('model' => 'Batch', 'add_empty' => true)),
      'status'            => new sfWidgetFormChoice(array('choices' => array('' => '', 'Pending' => 'Pending', 'Started' => 'Started', 'Grown' => 'Grown', 'Processed' => 'Processed', 'Marketed' => 'Marketed', 'Paid' => 'Paid'))),
      'inputdeliverydate' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'comments'          => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'recepient_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Recepient', 'column' => 'id')),
      'batch_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Batch', 'column' => 'id')),
      'status'            => new sfValidatorChoice(array('required' => false, 'choices' => array('Pending' => 'Pending', 'Started' => 'Started', 'Grown' => 'Grown', 'Processed' => 'Processed', 'Marketed' => 'Marketed', 'Paid' => 'Paid'))),
      'inputdeliverydate' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'comments'          => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('participation_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Participation';
  }

  public function getFields()
  {
    return array(
      'id'                => 'Number',
      'recepient_id'      => 'ForeignKey',
      'batch_id'          => 'ForeignKey',
      'status'            => 'Enum',
      'inputdeliverydate' => 'Date',
      'comments'          => 'Text',
    );
  }
}